import java.util.*;

public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int[] hash = new int[n+1];
        int hashMax = 0;
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            hash[a[i]]++;
            hashMax = Math.max(hashMax, hash[a[i]]);
        }
        
        for(int ret = 1; ret <= hashMax; ret++) {
            int sum = 0;
            for(int i = 1; i <= n; i++) {
                sum += hash[i] / ret + (hash[i] % ret == 0 ? 0 : 1);
            }
            if(sum <= m) {
                System.out.println(ret);
                return;
            }
        }
        System.out.println(-1);
    }
}